package com.nbst.controller;

import com.nbst.annotation.Log;
import com.nbst.model.People;
import com.nbst.service.PeopleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
public class BaseController {

    @Autowired
    PeopleService peopleService;

    @RequestMapping("/index")
    public String index(){
        return "/hello";
    }

    @RequestMapping("/hello")
    @Log
    public String hello(){
        return "hello";
    }

    @RequestMapping("/people")
    @ResponseBody
    @Log
    public People people(People record){
      return  peopleService.selectByPrimaryKey(record.getId());
    }
}
